Novel gain-tuning for sliding mode control of second-order mechanical systems: theory and experiments

The sliding mode control is well-known as a useful control technique that can be applied in several real-world applications. However, a straightforward and efficient process of selecting the sliding mode control gains remains a challenging but interesting topic. This paper investigates a novel gain tuning method for the sliding mode control of second-order mechanical systems. Firstly, we obtain relations between the gains and the natural and damping ratio of the closed-loop system. Secondly, the time constant of the system’s actuators and the system response performance criteria, including settling time and delay time, are taken into consideration to determine appropriate ranges of the gains. These gain ranges allow control designers to select the controller gains in a time-saving manner and ensure that the desired system performance is met and the actuators work properly. Finally, the proposed method is applied to the gain tuning process of a sliding mode altitude controller for an actual quadcopter unmanned aerial vehicle. Simulation and experimental results demonstrate the applicability and effectiveness of this method.

www.nature.com/scientificreports/ The above observations show that second-order mechanical systems actuated by actuators are omnipresent and play essential roles in many real-world applications. And the SMC technique is applied widely to control such systems. However, in most related existing studies [18][19][20][33][34][35] , the SMC was designed and tuned independently of the actuators' dynamics. Therefore, the actuators could be over-operated, and the saturation phenomenon could occur. Dealing with such problems requires additional efforts in control design and system analysis, which are usually complicated. Besides, in the works presented by [18][19][20][33][34][35] , the SMC's gain selection methods only guaranteed the systems' stability, while the desired performance (such as settling time and delay time) could only be achieved after tuning the gains by time-consuming trials and errors.
Motivated by the above observations, this paper focuses on finding out a method for determining the SMC's gains with a mathematical, systematic, and straightforward tuning process. Our work contributes to state-ofthe-art knowledge in three main ways: (1) Unlike the works in [18][19][20][33][34][35] , our novel method establishes a gain range, which allows control designers to pick appropriate gains quickly. The selected gains not only guarantee the system's stability but also ensure the system's desired performance (including settling time and delay time) is satisfied simultaneously. Hence, we can achieve satisfactory system performance without wasting time tuning the gains through trials and errors. (2) Also, unlike the exsiting studies [18][19][20][33][34][35] , our work takes the system's actuator dynamics into consideration to ensure the actuators are not over-operated. Therefore, from practical and economic points of view, the proposed method enhances the system's operation quality and saves costs as it lenthens the actuators' lifespan. (3) Through experiments with an actual quadcopter UAV, the theory presented in this paper is demonstrated as being highly reliable and applicable. It is worth noting that quadcopters are one typical class of secondorder systems. Hence, the successful implementation of the proposed method to this class indicates that it can also work for a broad range of systems in many real-world applications.
The remainder of this paper is organized as follows: The preliminaries and the problem statement are presented in Section "Preliminaries and problem statement", the proposed method in Section "Main results", an illustrative example with simulation and experimental results and discussion in Section "Illustrative example", and conclusions in Section "Conclusions".

Preliminaries and problem statement
Performance specification of feedback control systems. The operation and evaluation of a control system ( Fig. 1) are based on a set of performance specifications that typically include speed of response, stability, and accuracy 37 . In particular, for a first-order system, whose dynamic model is expressed as follows (with k being a dc gain): the time constant matrix, τ = diag(τ 1 , τ 2 , ..., τ n ) , is used as a specification in the system's performance evaluation. Meanwhile, for a second-order system, several parameters can be used. A simple model for a second-order system can be described as where, y(t) ∈ R n is the system's state vector, ζ = diag(ζ 1 , ζ 2 , ..., ζ n ) and ω n = diag(ω 1 , ω 2 , ..., ω n ) are the matrices of damping ratio and natural frequency, respectively, of the system. The delay time, τ d , and settling time (2%), τ s , of this system are calculated as and where, I n is the identity matrix in R n×n .
(1) τẏ(t) + y(t) = ku(t) Figure 1. General configuration of a feedback control system 36  www.nature.com/scientificreports/ The system's actuators play essential roles in satisfying predefined performance requirements. In particular, the system's response, which can be fast or slow or accurate or inaccurate, depends on the response speed and the accuracy of the actuators. When it comes to the response speed, the actuators' time constant is considered. For the system to have any change in its motions, it always takes a time interval longer than the actuators' time constant.

Sliding mode control. Consider the class of systems
the control input; f and h are sufficiently smooth functions with rank(h(x)) = m.
To design the sliding mode controller for this system, the sliding surface 4 is firstly designed as: where the function φ(x 1 ) ∈ R n is chosen such that when the motion is restricted to the surface, and the model is asymptotically stabilized at the origin. Next, to bring σ to zero in finite time and have it maintained there for all future time, the control input u is designed as where h inv (x) denotes the Moore-Penrose inverse 38 of h(x) , γ (x) ≥ 0 is a continuous function, and sat(σ ) is the saturation function, which is defined as sat(α) = [sat(α 1 ), sat(α 2 ), ..., sat(α n )] T , where, α i (i = 1, 2, ..., n) is the element of vector α ∈ R n , and In the existing studies and many practical applications 15,28 , it is seen that the functions φ(x 1 ) and γ (x) are chosen as and with K 1 and K 2 ∈ R n×n being positive definite diagonal matrices to be chosen.

Remark 1
From a practical point of view, it is common that a mechanical system has its closed-loop system's time constant much larger than its actuators' time constants. Therefore, for the sake of simplicity, the actuator dynamics is ignored in control design procedures in most existing studies [18][19][20][33][34][35] . Hence, it is seen in (8) that the control law u is designed without considering the system's actuator dynamics. However, in this work, the actuator dynamics will be taken into consideration to obtain appropriate values for the controller's gains K 1 and K 2 .

Main results
Relationship between the SMC gains and the closed-loop system's performance specifications. This subsection presents a method of determining the SMC's gains from the expected natural frequency and damping ratio of the closed-loop second-order system. (8) is applied to the system (5) then the following holds:

Theorem 1 If the controller
with ω n and ζ ∈ R n×n being the expected diagonal matrices of natural frequency and damping ratio, respectively, of the closed-loop system.
Proof From (6), (8), with φ(x 1 ) and γ (x) being chosen as in (10) and (11), we have Consider the following Lyapunov function candidate: V = 1 2 σ T σ . Then, the time derivative of V is The size N sat can fall into one of the following cases.
The observation in (14) indicates that if any element σ j of the sliding surface, σ , lies in the range |σ j | ≥ 1 , it will be forced back to the range |σ j | < 1 and asymptotically approaches the origin as long as the controller gains, K 1 and K 2 , are positive definite. The above analysis leads to examining the following case, Case 2.
The control input u can be rewritten as From (5) we have Substituting (16) into (17) yields Manipulating (18), we have It is seen in (19) that the dynamics of x 1 now is in the form of a second-order system in (2) where, This completes the proof of Theorem 1.
Appropriate gain ranges. Since the system's control performance criteria may vary with its applications, the set of controller's gains of a system used for one task can be significantly different from the ones that are used for another task. Therefore, in many cases, the gains obtained by solving (21) work but may not satisfy some control performance requirements, and a gain-tuning is needed. In this subsection, we discuss the limits the gains can reach during the tuning process.

Remark 2
By using equation (26) in Theorem 2, a graphical method, which is illustrated in Fig. 2, can be used to determine the maximum candidate value of k 2i .

Remark 3
It is worth noting that not only the delay time but also the rise time and peak time are the parameters that represent the speed of response of the system (5). These parameters can also be used to determine the controller gains. However, we used the delay time in this paper because it is helpful to obtain simple formulas like (25) and (26). Besides, since the settling time is related to the stability level of the system, we consider it alongside the delay time to achieve the most appropriate controller gains, which ensure both the response speed and the stability degree of the system.

Remark 4
The actuator time constant, τ A , is a measure of the motor's speed reaction time upon change in the terminal voltage (or the control input, in other words). Meanwhile, is defined as time constant of the system in (28), which means the reaction time of the system's response upon the changes in the sliding surface (or the control input, in other words). Therefore, τ A directly affects τ 1 and the system's settling time, τ 2 (the higher the τ A , the larger the τ 1 and τ 2 ). Hence, by considering τ A , our gain selection rules in Theorem 2 ensure the system's desired performance is satisfied without over-operating the actuators.

Illustrative example
The design and gain-tuning process of the SMC applied to the quadcopter UAV system is presented in this section to illustrate the applicability and effectiveness of the proposed method.  www.nature.com/scientificreports/ Quadcopter platform. Hardware and software. We used a quadcopter as the experimental platform ( Fig. 3), which is operated by an onboard flight computer unit (FCU) Pixhawk. The quadcopter attitude and acceleration are provided by an inertial navigation system (INS). We used a commercially available laser ranging sensor LidarLite V3 to measure the altitude and a commercial GPS receiver module to determine the vehicle's position. The quadrotor's translational velocities are extracted from an INS/GPS/Lidar Lite sensor fusion through an extended Kalman filter. Besides, a power supplying system (including a battery and a power adapter module), a set of remote control transmitter/receiver for the manual pilot, and a set of radio telemetry transmitter/receiver for the ground station monitoring were used. The motors of the quadcopter have a time constant of 0.1 s. The the vehicle attitude controller is operated at a frequency of 400 Hz, and the SMC altitude controller runs at 100 Hz. The block diagram in Fig. 4 briefly describes the signal flows in the experimental system.
Dynamics model. Since the quadcopter's dynamics was introduced and verified in several existing studies 39,40 , we only describe it briefly here. Four motors of the quadcopter generate four thrust forces F i ( i =1,...,4) that have a relation with four control inputs ( u i ) as The full cascaded dynamics model of the quadcopter is well-known as where, l is the quadcopter's arm length; c fm the force-to-momentum coefficient; I x , I y , I z the inertia momentum; m the mass; g the gravitational acceleration. x, y denote the position; z the altitude; and φ, θ , ψ the attitude of the vehicle in the inertial frame {E}. Details of the quadcopter's dynamical parameters are listed in Table 1. The method described in Sections "Preliminaries and problem statement" and "Main results" is applied in order to design a sliding mode altitude tracking controller for the quadcopter, and to tune the controller's gains.
Let us define the tracking error as  www.nature.com/scientificreports/ where, z d is the desired altitude. Thus, the first-order and second-order derivatives of e z can be calculated as and Let x 1 = e z and x 2 =ė z , we have We can see that (49) has the form of (5). Hence, we can apply the method presented in Section "Main results" to design a sliding mode altitude tracking controller for a quadcopter and tune the controller's gains.
Quadcopter's sliding mode altitude tracking controller. A sliding surface is introduced as with k 1 being a positive number to be chosen. Then, following Section "Main results", the control law is obtained as where, k 2 is a positive gain to be decided.
Our goal now is to choose the appropriate values for k 1 and k 2 such that the controller (51) satisfies the control criteria described in Table 2 and exhibits safe altitude tracking performance.
Simulation results. To examine the impact of the controller's gains on the system's performance, and verify the effectiveness of our method through this, we conducted a simulation with several scenarios, which are described as below.
(1) First, the appropriate gains are chosen and applied to the quadcopter system following the method presented in Section "Main results". After that, the controller gains are set with values that are (2) close to the appropriate gain range's boundary, and (3) beyond the appropriate gain range's boundary. An appropriate value of k 2 also needs to satisfy (26) which is graphically described in Fig. 5. It is seen in Fig. 5 that the (26) holds for all k 2 lie in the range from 0 up to 6.3. Therefore, let us choose k 2 = 6.2. (c) Check the system's performance and fine-tune the gains.
We are going to check the system's performance and slightly tune the above-obtained gains to achieve the best performance. It is seen in Fig. 6 that the altitude controller works stably, and the altitude tracking performance is roughly satisfactory. However, as shown in the inset of this figure, the settling time (2%) is about 4.7 s and does not satisfy the predefined condition, i.e., τ 2 = 4 s, even though it is not far from the desired value. Therefore, we continue tuning the gains for the controller to meet the control criteria. A slight increase of k 1 is followed by an update of k 2 , which is ruled by (25) and (26). After a few times of fine-tuning, it turns out that we achieved the most satisfactory performance when k 1 = 1.05 and k 2 = 7 (Fig. 7)..
(52) 0.25 ≤ k 1 < 2.0 (53) k 2 ≤ 6.3 www.nature.com/scientificreports/  www.nature.com/scientificreports/ Gains close to the appropriate gain range's boundary. Let us now examine the system's performance when the gains are set at the values close to the appropriate gain range, which is determined in the previous Section "Appropriate gains for the most satisfactory performance". That is, the gain k 1 is going to be set as 0.25 and 1.9 (Fig. 8).
With k 1 = 0.25 , following (25), we have k 2 ≤ 1.75 . By choosing k 2 = 1.75 , we have the system exhibits too weak response to the command. The maximum vertical speed only reaches 0.19 m/s, and the system takes about 19.5 seconds to achieve the 2% settling state as a result.
On the other hand, when we set k 1 = 1.9 and choose k 2 = 13.3 (since k 2 ≤ 13.3 ), the system response becomes markedly faster. It can be seen (in Fig. 8) that the maximum vertical speed reaches 1.9 m/s and that there are some slight jerks in the quadcopter's movement. In addition, the settling time is only 2 s in this case.
Generally, it can be said that, even though the quadcopter does not exhibit performance as good as it is desired, its flights are still stable and safe when the gains are set inside but closed to the boundary of the appropriate gain range.
Gains beyond the appropriate gain range. In this sub-sub section, we intentionally choose the gains k 1 and k 2 , which do not satisfy (23) and (26). That is, the following is going to be selected: Let us choose k 1 = 12 . With this value of k 1 , we can choose k 2 = 30 so that (26) is not satisfied (Fig. 9).
The system's performance corresponding to these values (Fig. 10) is devastating. We can see from Figs. 8 and 10 that it is difficult and time-consuming to have satisfactory performance when we choose controller gains through trials and errors because the gains we choose can easily lie beyond the appropriate range. In Phase 1 (initialization), the quadcopter is turned on and armed on the ground. Afterward, when the time t ≈ 12.5 s, Phase 2 (take-off) is enabled, the quadcopter is commanded to take-off and climb to reach an altitude of 1.5 m. At t ≈ 29.2 s, while the quadcopter is hovering at 1.5m-height, an altitude step setpoint of 2.5 m is sent  www.nature.com/scientificreports/ to the quadcopter that starts Phase 3 (ascent). In Phase 4 ( t ≈ 46 s), the quadcopter exhibits a descent flight from the altitude of 2.5 to 1.5 m. The final phase, starting at t ≈ 64 s, is the landing phase in which the vehicle descent to reach the ground before being disarmed and turned off. Not only the altitdue tracking ( Fig.11)but also the vertical velocity, control input, and sliding surface (Fig. 12) demonstrate the closed-loop system's performance, thereby indicating the efficacy our controller gain-tuning process. As per Table 3, the settling time (2%) performance of the quadcopter in each phase is slightly different yet close to the expected value, i.e., 4 s. These minor differences may be caused by several factors, such as system uncertainties, ground effect, and external disturbances. It is also seen from Table 3 that the controller gains we obtained in the previous section, without additional gain-tuning, deliver stable and safe experimental performance throughout the phases of the flight.

Conclusions
An SMC gain-tuning method is presented and validated in this paper. This method considers system's actuator dynamics to ensure the actuators are not over-operated and to avoid the saturated phenomenon, which shortens the system's lifespan and degrades its operation quality. Further, the proposed gain selection rules allow control designers to select appropriate gains for their controllers in a straightforward and time saving way. The numerical simulation and the experiment results demonstrated that the gains obtained by our method deliver stable and satisfactory performance to the system. Hence, this work can be applied to a wide range of systems that use the SMC technique. Our future study is directed to an efficient gain-tuning procedure for second-order SMC controllers based on this paper.